package com.lwz.observe;

import java.util.ArrayList;
import java.util.List;

public class ConcreteSubject  implements Subject{
	
	List<Observer> observerList = new ArrayList<Observer>();

	@Override
	public void addObserver(Observer o) {
		if(!observerList.contains(observerList)){
			observerList.add(o);
		}
		
	}

	@Override
	public void removeObserver(Observer o) {
		if(!observerList.contains(o)){
			observerList.remove(o);
		}
	}

	@Override
	public void notifyAllObserver() {
		for(Observer o:observerList){
			o.update();
		}
	}

}
